package com.example.android.camera2video;
import android.content.SharedPreferences;
import android.content.Context;
import android.app.Activity;
class Config {

    private long format;
    private long venc;
    private long aenc;

    public void save(Activity ac) {
        // Storing data into SharedPreferences
        SharedPreferences sharedPreferences = ac.getSharedPreferences("MySharedPref", Context.MODE_PRIVATE);

        // Creating an Editor object to edit(write to the file)
        SharedPreferences.Editor myEdit = sharedPreferences.edit();

// Storing the key and its value as the data fetched from edittext
        myEdit.putLong("format", format);
        myEdit.putLong("venc", venc);
        myEdit.putLong("aenc", aenc);
// Once the changes have been made,
// we need to commit to apply those changes made,
// otherwise, it will throw an error
        myEdit.commit();
    }

    public void load(Activity ac) {
        // Retrieving the value using its keys the file name
// must be same in both saving and retrieving the data
        SharedPreferences sh = ac.getSharedPreferences("MySharedPref", Context.MODE_PRIVATE);

        // The value will be default as empty string because for
// the very first time when the app is opened, there is nothing to show
        format = sh.getLong("format", 0);
        venc = sh.getLong("venc", 0);
        aenc = sh.getLong("aenc", 0);

    }
    public long getVEnc(){
        return venc;
    }
    public long getAEnc(){
        return aenc;
    }
    public long getFormat(){
         return format;
    }
    public Config setAEnc(int v){
        aenc=v;
        return this;
    }
    public Config setVEnc(int v){
        venc=v;
        return this;
    }
    public Config setFormat(int v){
        format=v;
        return this;
    }


}